package cn.chinahadoop.scala

class Basic {
  
}

object Basic{
  
  def hello(name : String) : String = {
    "Hello :" +name
  }
  
  def helloScala(){
    println("hello Scala!!!")
  }
  
  val add = (x : Int,y : Int) =>x + y
  
  def add2(x : Int)(y : Int) = x + y
  
  /*
   *  '*'代表 接受一系列的此种类型的参数，代表多个参数
   **/
  def printEveryChar(c : String*) = {
    c.foreach(x => println(x))
  }
  
   def main(args: Array[String]): Unit = {
//    println(hello("Hello Scala!"));
//    helloScala();
//     printEveryChar("a","b","c","d")
     
//     var x = 1
//     val a = if(x>0) 1 else 0
//     println(a)
     
     //foreach
//     for(i <- 1 to 10 ){
//       println(i)
//     }
     
     for(i <-1 until 10){
       println(i)
     }
     
     for(i <-1 to 10 if i%2 == 0){
       println(i)
     }
  }
  
  
}